﻿using System;
using System.Collections.Generic;
using System.Text;
using RAP.Framework.Libary.Utils;
using RAP.Framework.Libary.DomTemplateBuilder.Interface;

namespace RAP.Framework.Libary.DomTemplateBuilder.Handler
{
	/// <summary>
	/// 回调节点渲染器
	/// </summary>
	public class CallbackHandler : DynamicHandler
    {
        /// <summary>
        /// 回调队列字段名称：callback-runing-queue
        /// </summary>
        internal const string CALLBACK_RUNGING_QUEUE = "callback-runing-queue";

        public override void DoRender( StringBuilder writer, object rootParamObject, object parentParamObject, ITemplateRenderContext context )
        {
			var callbacks = context.Callbacks;
            if ( callbacks != null )
            {
                callbacks.Add( ( param, ctx ) =>
                {
                    base.DoRender( writer, param, parentParamObject, context );
                } );
            }
        }
    }
}
